#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    unordered_map<int, int> cnts;
    while(cin >> n && n != 0){
        int cnt = 0, s = n;
        while(n != 1){
            if(cnts.count(n)){
                cnt += cnts[n];
                cnts[s] = cnt;
                break;
            }
            if(n & 1) n = (n * 3 + 1) / 2;
            else n /= 2;
            ++cnt;
        }
        cnts[s] = cnt;
        cout << cnt << endl;
    }
}